package ui;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComboBox;
import javax.swing.JFrame;

public class ComboBoxTest extends JFrame{
	private static String[] place = {"浙江", "上海", "江苏"};

	private Object[] a() {
		Object[] os = new Object[place.length];
		for (int i = 0; i < place.length; i++) {
			os[i] = place[i];
		}
		return os;
	}

//	public static void main(String[] args) {
//		final ComboBoxTest ct = new ComboBoxTest();
//		final JComboBox<Object> ca = new JComboBox<Object>(place);
//		ca.setSelectedIndex(1);
//		ca.addActionListener(new ActionListener() {
//			public void actionPerformed(ActionEvent e) {
//				Object selected = ca.getSelectedItem();
//				System.out.println("selected:   "+selected);
//			}
//		});
//		ct.setLayout(null);
//		ca.setSelectedIndex(0);
////		ca.setLocation(100, 100);
////		ca.setBounds(100, 100, 100, 50);
//		ct.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//		ct.getContentPane().setLayout(new FlowLayout(FlowLayout.LEFT));
//		ct.setLocationRelativeTo(null);
//		ct.add(ca);
//		ct.setVisible(true);
//		ct.setSize(300, 300);
//	}
}
